﻿<!DOCTYPE html>
<html><head><meta charset="UTF-8">
<title></title>

<script>
	onload = function(){
		var button = document.getElementById("btn");
		button.onclick = function(e){
			var event = e;
			if(event.offsetX <= 100 && event.offsetY <= 100){
				this.style.background = "black";
			} else if(event.offsetX > 100 && event.offsetY <= 100){
				this.style.background = "yellow";
			}
		}
	}
</script>
</head>
<body>
	<div id="btn" style="width:200px; height:200px; background:red;">未点击</div>
</body>
</html>